package jaoso.framework.dao;

import jaoso.framework.domain.Account;

import java.io.Serializable;

/**
 * @author edgeloner
 * @version 0.9.1
 * @since 2004-5-29 Account DAO, persistent Account.
 */
public interface AccountDAO extends DAO
{
    /**
     * get account by id from database
     * 
     * @param id
     *            account id
     * 
     * @return account if account not fount return null
     *  
     */
    Account getAccount(Serializable id);

    /**
     * get account by name from database
     * 
     * @param name
     *            account name
     * 
     * @return account if account not fount return null
     *  
     */
    Account getAccountByName(String name);

    /**
     * check account name already exist
     * 
     * @param name
     *            account name
     * 
     * @return boolean
     */
    boolean isExist(String name);

    /**
     * check account name already exist
     * 
     * @param name
     *            account name
     * @param id
     *            account id
     * 
     * @return boolean
     */
    boolean isExist(String name, Serializable id);

    /**
     * create a new account
     * 
     * @param accout
     *            account
     *  
     */
    void createAccount(Account accout);

    /**
     * find account by query
     * 
     * @param query
     *            sql or hsql query
     * 
     * @return account array
     *  
     */
    Account[] findAccount(String query);

    /**
     * find all account from database
     * 
     * @param query
     *            query
     * @return account array
     *  
     */
    Account[] findAccount(MyQuery query);

    /**
     * find account by MyQuery
     * 
     * @return account array
     *  
     */
    Account[] findAllAccount();

    /**
     * remove account
     * 
     * @param account
     *            account
     *  
     */
    void removeAccount(Account account);

    /**
     * remove account
     * 
     * @param id
     *            account id
     *  
     */
    void removeAccount(Serializable id);

    /**
     * remove account
     * 
     * @param id
     *            account id array
     *  
     */
    void removeAccount(Serializable[] id);

    /**
     * update account
     * 
     * @param account
     *            account
     *  
     */
    void updateAccount(Account account);
}